﻿#ifndef __KEY_TASK_H__
#define __KEY_TASK_H__
#ifdef __cplusplus
extern "C" {
    #endif

    #include "main.h"
    #include "event_groups.h"


    /* publish event group bit, short press in low 8 bit, long press in sublow 8 bit  */
    #define KEY_EVENT_GROUP_SHORT_PRESS_4    (1 << 0) /*!< key 4 short press */
    #define KEY_EVENT_GROUP_SHORT_PRESS_5    (1 << 1) /*!< key 5 short press */
    #define KEY_EVENT_GROUP_SHORT_PRESS_6    (1 << 2) /*!< key 6 short press */
    #define KEY_EVENT_GROUP_SHORT_PRESS_7    (1 << 3) /*!< key 7 short press */
    #define KEY_EVENT_GROUP_SHORT_PRESS_ALL  (0xf << 0) /*!< all key short press */

    #define KEY_EVENT_GROUP_LONG_PRESS_4    (1 << 8)  /*!< key 4 long press */
    #define KEY_EVENT_GROUP_LONG_PRESS_5    (1 << 9)  /*!< key 5 long press */
    #define KEY_EVENT_GROUP_LONG_PRESS_6    (1 << 10) /*!< key 6 long press */
    #define KEY_EVENT_GROUP_LONG_PRESS_7    (1 << 11) /*!< key 7 long press */
    #define KEY_EVENT_GROUP_LONG_PRESS_ALL  (0xf << 8) /*!< all key long press */


    typedef enum
    {
        KEY_NONE = 0,
        KEY_SHORT_PRESS, /*!< key short press */
        KEY_LONG_PRESS,  /*!< key long press */
    }KeyAction;


    extern EventGroupHandle_t keyEventGroupHandle;

    extern TaskHandle_t keyTaskHandle;

    /**
     * @brief key task
     * @param pvParameters task parameter
     */
    void KeyTask(void *pvParameters);

    #ifdef __cplusplus
}
#endif
#endif // KEY_TASK_H
